
package unq.edu.cui.tp.arena;

import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.aop.windows.TransactionalDialog;
import org.uqbar.arena.layout.ColumnLayout;
import org.uqbar.arena.widgets.Button;
import org.uqbar.arena.widgets.Label;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.widgets.Selector;
import org.uqbar.arena.widgets.TextBox;
import org.uqbar.arena.windows.WindowOwner;

import unq.edu.cui.tp.dominio.Empleado;
import unq.edu.cui.tp.modelo.ventanas.AgregarRestriccion;

public class AgregarRestriccionesWindow extends TransactionalDialog<AgregarRestriccion> {
	
	public AgregarRestriccionesWindow(WindowOwner parent, AgregarRestriccion modeloVentana) {
		super(parent, modeloVentana);
		
	}
	@Override
	protected void createFormPanel(Panel mainPanel) {
		Panel form = new Panel(mainPanel);
    	form.setLayout(new ColumnLayout(2));
        this.setTitle("Agregar restriccion");
        
        new Label(form).setText("Empleados");
        Selector empleados= new Selector<Empleado>(form);
        empleados.bindItemsToProperty("sistema.empleados");
        empleados.bindValueToProperty("empleadoSeleccionado");
        
        new Label(form).setText("Fecha");
        new TextBox(form).bindValueToProperty("fecha");
        
        new Button(form).setCaption("Aceptar").onClick(new MessageSend(this,"agregarRestriccion"));
        new Button(form).setCaption("Cancelar").onClick(new MessageSend(this, "cancel"));
		
	}
////********************************************************
////** Acciones
////**************************************************
	public void agregarRestriccion(){
		this.getModelObject().agregarRestriccion();
		this.accept();
	}
}



